#!/bin/bash

# Describe:     Sync VPN config file from iCloud
# Create Date:  2021-11-04
# Create Time:  15:45
# Update Date:  2021-11-04
# Update Time:  15:57
# Author:       MiaoCunFa
# Version:      v0.0.3

#===================================================================

workPath="$HOME/workspace/gongjiangren/vpn"
CloudPath="$HOME/Library/Mobile\ Documents/com~apple~CloudDocs/Personal_Sync_in_iCloud/vpn"

mkdir -p $workPath
cp $CloudPath/* $workPath

cd $workPath
sed -i 's@ca.crt@$workPath/ca.crt@g' *.ovpn
sed -i 's@miaocunfa.crt@$workPath/miaocunfa.crt@g' *.ovpn
sed -i 's@miaocunfa.key@$workPath/miaocunfa.key@g' *.ovpn
sed -i 's@ta.key@$workPath/ta.key@g' *.ovpn
sed -i 's@ca.crt@$workPath/ca.crt@g' *.ovpn
